<template>
  <div>
    <h1>自定义组件2</h1>
    <p>{{ text }}</p>
    <p>{{ num }}</p>
  </div>
</template>

<script>
export default {
  name: "component2",
  props: {
    text: {
      type: String,
      required: true,
      default: ""
      //validator()
    },
    num: {
      type: Number,
      required: false,
      default: 0,
      // 校验器：传过来的参数必须满足对应条件
      validator(val) {
        return val > 100;
      }
    }
  }
};
</script>
<style lang="stylus" scoped></style>
